<template>
	<!--科技成果管理-->
	<div class="container-app">
		<div style="margin-bottom:15px;">
			<el-button v-if="hasAdd" size="small" type="success" @click="addLine"><i class="el-icon-plus"></i>{{addTitle}}</el-button>
			<el-button v-if="hasDel" size="small" type="danger" @click="removeLine"><i class="el-icon-delete"></i>{{delTitle}}</el-button>
			<el-button v-if="hasUpdate" size="small" type="primary" @click="changeLine"><i class="el-icon-edit-outline"></i>{{updateTitle}}</el-button>
			<span class="right-search">
	        <!--<el-input @change="findLine" v-model="findData" class="listinput" size="small" placeholder="输入关键字搜索" style="width:300px;">
	          <el-button @click="findLine" slot="append" icon="el-icon-search"></el-button>
	        </el-input>
	        <el-button @click="resetLine" size="mini"><i class="el-icon-refresh"></i>重置</el-button>-->
	      </span>
		</div>
		<!--酒定价信息管理列表-->
		<el-table @selection-change="getRow" :data="tableData" tooltip-effect="dark" style="width: 100%" border v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.5)">
			<el-table-column type="selection" width="55"></el-table-column>
			<el-table-column prop="stTitle" label="成果名称"></el-table-column>
			<!--<el-table-column prop="userTel" label="所属模块"></el-table-column>
			<el-table-column prop="userRealName" label="所属模块值"></el-table-column>-->
			<el-table-column prop="stBelong" label="成果所属"></el-table-column>
			<el-table-column prop="stActor" label="成果参与人" width="160"></el-table-column>
			<el-table-column prop="stArea" label="所在区域" width="160"></el-table-column>
			<el-table-column prop="adStatus" label="审核状态">
				<template slot-scope="scope">
					<span v-if="scope.row.adStatus == 1" style="color: green;">通过</span>
					<span v-else-if="scope.row.adStatus == 0" style="color: #de8a09;">不通过</span>
					<span v-else></span>
				</template>
			</el-table-column>
			<el-table-column prop="createTime" label="创建时间" width="160"></el-table-column>
			<el-table-column label="操作" width="220">
				<template slot-scope="scope">
					<el-button type="success" size="mini" @click="viewLine(scope.row)">
						<i class="el-icon-check"></i> 查看详情
					</el-button>
					<el-button v-if="hasCheck" size="small" type="primary" @click="checkLine(scope.row)"><i class="el-icon-plus"></i>{{checkTitle}}</el-button>
				</template>
			</el-table-column>
		</el-table>
		<el-col :span="24" class="paging">
			<span>总条数：{{dataTotal}}</span>
			<el-pagination @current-change="changePage" :page-size="10" :total="dataTotal" background layout="prev, pager, next" style="float:right;"></el-pagination>
		</el-col>
		<!--新增修改对话界面-->
		<el-dialog :title="title" :visible.sync="isDialog" width="60%" :before-close="handleClose" :close-on-click-modal='false'  v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.5)">
			<el-form size="small" :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="form-submit">
				<el-form-item label="成果名称：" prop="stTitle">
		          <el-input size="small" v-model="ruleForm.stTitle"  placeholder="请输入成果名称" maxlength="50" ></el-input>
		        </el-form-item>
		        <el-form-item label="成果所属：" prop="stBelong">
		          <el-input size="small" v-model="ruleForm.stBelong"  placeholder="请输入成果所属" maxlength="50"></el-input>
		        </el-form-item>
				<el-form-item label="成果参与人：" prop="stActor">
					<el-input size="small" v-model="ruleForm.stActor" placeholder="多人用逗号隔开，如：张三,李四" maxlength="50"></el-input>
				</el-form-item>
				<el-form-item label="所在区域：" prop="stArea">
					<el-input size="small" v-model="ruleForm.stArea" placeholder="请输入所在区域" maxlength="50"></el-input>
				</el-form-item>
				<el-form-item label="联系人：" prop="ctPeople">
					<el-input size="small" v-model="ruleForm.ctPeople" placeholder="请输入联系人"></el-input>
				</el-form-item>
				<el-form-item label="联系电话：" prop="ctTel">
					<el-input size="small" v-model="ruleForm.ctTel" placeholder="请输入联系电话"></el-input>
				</el-form-item>
				<el-form-item label="联系邮箱：" prop="ctEmail">
					<el-input size="small" v-model="ruleForm.ctEmail" placeholder="请输入联系邮箱"></el-input>
				</el-form-item>
				<el-form-item label="成果关键字：" prop="stKeys">
					<el-input size="small" v-model="ruleForm.stKeys" placeholder="请输入成果关键字"></el-input>
				</el-form-item>
				<el-form-item label="成果简介：" prop="stDetail">
					<el-input type="textarea" resize="none" :rows="3" v-model="ruleForm.stDetail" maxlength="500" placeholder="请输入成果简介"></el-input>
				</el-form-item>
				<el-form-item label="专利名称：" prop="ptTitle">
					<el-input size="small" v-model="ruleForm.ptTitle" placeholder="请输入专利名称" maxlength="100"></el-input>
				</el-form-item>
				<el-form-item label="专利号：" prop="ptNo">
					<el-input size="small" v-model="ruleForm.ptNo" placeholder="请输入专利号" maxlength="100"></el-input>
				</el-form-item>
				<el-form-item label="评估价值：" prop="evaluationValue">
		            <el-upload
					  class="upload-demo"
					  :action="action"
					  :on-preview="handlePreview"
					  :on-remove="handleRemoveevaluationValue"
					  :on-success="handleAvatarSuccessevaluationValue"
					  :file-list="evaluationValuefileList"
					  :auto-upload="true"
					  list-type="picture">
					  <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
					  <div slot="tip" class="el-upload__tip"></div>
					</el-upload>
		        </el-form-item>
		        <el-form-item label="科技图片：" prop="techPic">
		            <el-upload
					  class="upload-demo"
					  :action="action"
					  :on-preview="handlePreview"
					  :on-remove="handleRemovetechPic"
					  :on-success="handleAvatarSuccesstechPic"
					  :file-list="techPicfileList"
					  :auto-upload="true"
					  list-type="picture">
					  <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
					  <div slot="tip" class="el-upload__tip"></div>
					</el-upload>
		        </el-form-item>
		        <el-form-item label="成熟度透明：" prop="proofOfMaturity">
		            <el-upload
					  class="upload-demo"
					  :action="action"
					  :on-preview="handlePreview"
					  :on-remove="handleRemoveproofOfMaturity"
					  :on-success="handleAvatarSuccessproofOfMaturity"
					  :file-list="proofOfMaturityfileList"
					  :auto-upload="true"
					  list-type="picture">
					  <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
					  <div slot="tip" class="el-upload__tip"></div>
					</el-upload>
		        </el-form-item>
		        <el-form-item label="水平评价：" prop="levelEvaluation">
		            <el-upload
					  class="upload-demo"
					  :action="action"
					  :on-preview="handlePreview"
					  :on-remove="handleRemovelevelEvaluation"
					  :on-success="handleAvatarSuccesslevelEvaluation"
					  :file-list="levelEvaluationfileList"
					  :auto-upload="true"
					  accept=".jpg,.png,.gif"
					  list-type="picture">
					  <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
					  <div slot="tip" class="el-upload__tip"></div>
					</el-upload>
		        </el-form-item>
				<el-form-item label="发布人：" prop="stResName">
					<el-autocomplete
					  v-model="ruleForm.stResName"
					  :fetch-suggestions="querySearchAsync"
					  placeholder="请输入内容"
					  @select="handleSelect" style="width: 100%;">
					  <template slot-scope="{ item }">
				    	<div class="name"><span>{{ item.userTel }}</span></div>
				  	  </template>
					</el-autocomplete>
				</el-form-item>
				<el-form-item label="发布时间：" prop="stResTime">
					<el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss" style="width:100%" v-model="ruleForm.stResTime" placeholder="请输入发布时间"></el-date-picker>
				</el-form-item>
				<el-form-item
					v-for="(modelVal, index) in modelList"
				    :label="modelVal.mdTitle +'：'"
				    :key="modelVal.mdId">
					<el-select v-model="modelVal.mdVId" clearable placeholder="请选择模块类型" @change="selectModel($event,modelVal,index)" style="width: 100%">
						<el-option
						 v-for="item in modelVal.mvList"
						 	:key="item.mvId"
							:label="item.mvTitle"
							:value="item.mvId">
						</el-option>
					</el-select>
	          </el-form-item>
			</el-form>
			<span slot="footer" style="padding-right:30px;">
	        	<el-button size="small" v-if="!isClickBtn" type="success" @click="submitForm('ruleForm')">保存</el-button>
	        	<el-button size="small" v-else type="success" disabled>保存</el-button>
	        	<el-button v-show="changeVisible" size="small" type="warning" @click="resetForm('ruleForm')">重置</el-button>
	       		<el-button size="small" @click="cancleForm('ruleForm')">取消</el-button>
	        </span>
		</el-dialog>
		<!--查看详情-->
		<el-dialog title="科技成果信息" :visible.sync="isDetails" width="60%" :before-close="handleClose" :close-on-click-modal='false' v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.5)">
			<el-form size="small" :model="ruleForm" ref="ruleForm" label-width="120px" class="form-submit">
				<el-form-item label="成果名称：" prop="stTitle">
		          <el-input size="small" v-model="ruleForm.stTitle" readonly></el-input>
		        </el-form-item>
		        <el-form-item label="成果所属：" prop="stBelong">  
		          <el-input size="small" v-model="ruleForm.stBelong" readonly></el-input>
		        </el-form-item>
				<el-form-item label="成果参与人：" prop="stActor">
					<el-input size="small" v-model="ruleForm.stActor" readonly></el-input>
				</el-form-item>
				<el-form-item label="所在区域：" prop="stArea">
					<el-input size="small" v-model="ruleForm.stArea" readonly></el-input>
				</el-form-item>
				<el-form-item label="联系人：" prop="ctPeople">
					<el-input size="small" v-model="ruleForm.ctPeople" readonly></el-input>
				</el-form-item>
				<el-form-item label="联系电话：" prop="ctTel">
					<el-input size="small" v-model="ruleForm.ctTel" readonly></el-input>
				</el-form-item>
				<el-form-item label="联系邮箱：" prop="ctEmail">
					<el-input size="small" v-model="ruleForm.ctEmail" readonly></el-input>
				</el-form-item>
				<el-form-item label="成果关键字：" prop="stKeys">
					<el-input size="small" v-model="ruleForm.stKeys" readonly></el-input>
				</el-form-item>
				<el-form-item label="成果简介：" prop="stDetail">
					<el-input type="textarea" resize="none" :rows="3" v-model="ruleForm.stDetail" readonly></el-input>
				</el-form-item>
				<el-form-item label="专利名称：" prop="ptTitle">
					<el-input size="small" v-model="ruleForm.ptTitle" readonly></el-input>
				</el-form-item>
				<el-form-item label="专利号：" prop="ptNo">
					<el-input size="small" v-model="ruleForm.ptNo" readonly></el-input>
				</el-form-item>
				<el-form-item label="发布人：" prop="stResName">
					<el-input size="small" v-model="ruleForm.stResName" readonly></el-input>
				</el-form-item>
				<el-form-item label="发布时间：" prop="stResTime">
					<el-input size="small" v-model="ruleForm.stResTime" readonly></el-input>
				</el-form-item>
				<el-form-item label="评估价值：" prop="evaluationValue">
					<img v-for="item in evaluationValuefileList" :src="item.url" style="width: 160px; height: 160px;margin-right: 10px;" />
				</el-form-item>
				<el-form-item label="技术图片：" prop="techPic">
					<img v-for="item in techPicfileList" :src="item.url" style="width: 160px; height: 160px;margin-right: 10px;" />
				</el-form-item>
				<el-form-item label="成熟度证明：" prop="proofOfMaturity">
					<img v-for="item in proofOfMaturityfileList" :src="item.url" style="width: 160px; height: 160px;margin-right: 10px;" />
				</el-form-item>
				<el-form-item label="水平评价：" prop="levelEvaluation">
					<img v-for="item in levelEvaluationfileList" :src="item.url" style="width: 160px; height: 160px;margin-right: 10px;" />
				</el-form-item>
				<el-form-item
					v-for="(modelVal, index) in modelList"
				    :label="modelVal.mdTitle +'：'"
				    :key="modelVal.mdId">
					<template v-for="item in modelVal.mvList">
						<el-button v-if="item.mvId"  v-show="modelVal.mdVId == item.mvId" class="isactive" size="mini">{{item.mvTitle}}</el-button>
						<el-button v-if="item.mvId" v-show="modelVal.mdVId != item.mvId" size="mini">{{item.mvTitle}}</el-button>
						<!--<el-button size="mini" :class="!item.isactive">超小按钮</el-button>-->
					</template>
				</el-form-item>
			</el-form>
			<span slot="footer" style="padding-right:30px;">
        <el-button size="small" @click="cancleForm('ruleForm')">关闭</el-button>
      </span>
		</el-dialog>
	</div>
</template>

<script>
	import {      
		getserver,
		postserver,
		postjsonserver,
		getImgUrl
	} from '@/api/basicFunction'
	export default {
		data() {
			return {
				inputVisible: false,
				inputValue: '',
				isDetails: false,
				isDialog: false,
				loading: true,
				isUsable: 1,
				changeVisible: true,
				hasAdd: false,
				hasDel: false,
				hasUpdate: false,
				hasCheck: false,
				isClickBtn: false,
				addTitle: '新增',
				updateTitle: '修改',
				delTitle: '删除',
				checkTitle: '审核',
				title:'发布科技成果',
				selectData: [],
				dataPage: 1,
				dataTotal: 1,
				tableData: [],
				stResidOptions: [],
				evaluationValuefileList:[],
				techPicfileList:[],
				levelEvaluationfileList:[],
				proofOfMaturityfileList:[],
				evaluationValuelist:[],
				techPiclist:[],
				proofOfMaturitylist:[],
				levelEvaluationlist:[],
				action: process.env.SAVE_IMG_API+'transferMangeImg',
				modelList:[],
				modelPropsList:[{
					mdId:'',
					mdTitle:'',
					mdType: '',
					mvId:'',
					mvTitle:''
				}],
				ruleForm: {
					id: '',
					stResTime: '',//发布时间
					stResId : '',//发布人ID
					ptNo : '',//专利号
					ptTitle : '',//专利名称
					stDetail : '',//成果简介
					stKeys : '',//关键字
					ctEmail : '',//联系邮箱
					ctTel: '',//联系电话
					ctPeople: '',//联系人
					stArea: '',//所在区域
					stActor: '',//参与人
					stBelong: '',//成果所属
					stTitle: '',//成果标题
					stResName: '',
				},
				removeIds: [],
				selectId: '',
				isAdd: true,
				findData: '',
				rules: {
					stTitle: [{
						required: true,
						trigger: 'blur',
						message: '请输入成果名称'
					}],
					stBelong: [{
						required: true,
						trigger: 'blur',
						message: '请输入成果所属'
					}],
					/*stResName: [{
						required: true,
						trigger: 'change',
						message: '请选择发布人'
					}],*/
					stResTime: [{
						required: true,
						trigger: 'blur',
						message: '请输入发布时间'
					}]
				},
			}
		},
		filters: {
			formatuserType(value) {
				if(value == '1'){
					return '个人'
				}else if(value == '2'){
					return '学校'
				}else if(value == '3'){
					return '企业'
				}else if(value == '4'){
					return '科研机构'
				}else if(value == '5'){
					return '其他'
				}else {
					return ''
				}
			}
		},
		mounted() {
			this.getJur()
			this.getPageList()
			this.getModelAllList()
		},
		methods: {
			querySearchAsync(queryString, callback) {
		    	let para ={}
		    	if(queryString) 
		    		para.keyword = queryString
		    	getserver(para, "/clientUser/search").then(res => {
					if(res.code == '200') {
						callback(res.data)
					} else {
						this.$message({
							type: 'error',
							message: res.message
						})
					}
				})
		    },
			handleSelect(item) {
				this.ruleForm.stResName = item.userTel
				this.ruleForm.stResId = item.id
			},
			getJur() {
				const self = this
				console.log('role')
				self.$store.dispatch('Juage', self.$store.clickMenuId).then(res => {
					console.log('role1')
					if(res.code == '200') {
						console.log('role2')
						res.data.forEach(item => {
							if(item.type == '3') {
								self.hasAdd = true
								self.addTitle = item.title
							}
							if(item.type == '5') {
								self.hasDel = true
								self.delTitle = item.title
							}
							if(item.type == '4') {
								self.hasUpdate = true
								self.updateTitle = item.title
							}
							if(item.type == '7') {
								self.hasCheck = true
								self.checkTitle = item.title
							}
							console.log('role2')
						})
					} else if(res.code !== '507') {
						this.$message({
							type: 'error',
							message: res.message
						})
					}
				})
			},
			getPageList() {
				const para = {
					pageIndex: this.dataPage,
					pageSize: 10
				}
				console.log(process.env.GET_IMG_API)
				getserver(para, "/techGain/getPageList").then(res => {
					if(res.code == '200') {
						this.loading = false
						this.dataTotal = res.data.total
						this.tableData = res.data.records
						console.log(this.tableData)
					} else {
						this.$message({
							type: 'error',
							message: res.message
						})
					}
				})
			},
			getModelAllList(){
				getserver({mdType:1}, "/md/getDetailAll").then(res => {
					if(res.code == '200') {
						let _arr =[]
						let _v = {
								mvId:'',
								mvTitle:'请选择模块值信息'
							}
						for(let i=0;i<res.data.length;i++){
							_arr.push({
								mdId:'',
								mdTitle:'',
								mdType: '',
								mvId:'',
								mvTitle:''
							})
							res.data[i].mdVId = ''
							res.data[i].mvList.unshift(_v)
						}
						this.modelPropsList = _arr;
						this.modelList = res.data
						console.log(this.modelPropsList,this.modelList)
					} else {
						this.$message({
							type: 'error',
							message: res.message
						})
					}
				})
			},
			selectModel(e,obj,index){
				for(let i=0;i<this.modelPropsList.length;i++){
					if(i == index){
						if(e){
							this.modelPropsList[i].mvId = e 
							this.modelPropsList[i].mdId = obj.mdId
							this.modelPropsList[i].mdType = obj.mdType 
							this.modelPropsList[i].mdTitle = obj.mdTitle 
						}else{
							this.modelPropsList[i].mvId = '' 
							this.modelPropsList[i].mdId = ''
							this.modelPropsList[i].mdType = ''
							this.modelPropsList[i].mdTitle = ''
						}
						
					}
				}
			},
			changePage(val) {
				this.dataPage = val
				this.getPageList()
			},
			handleClose() {
				this.isDialog = false
				this.isDetails = false
			},
			submitForm(formName) {
				const self = this
				self.$refs[formName].validate((valid) => {
					if(valid) {
						let para = self.ruleForm
						let _tagList = []
						for(let i=0;i<self.modelPropsList.length;i++){
							if(self.modelPropsList[i].mdId){
								_tagList.push({'mdType':self.modelPropsList[i].mdType,'mdId':self.modelPropsList[i].mdId,'mvId':self.modelPropsList[i].mvId})
							}else{
								this.$message({
									type: 'error',
									message: '请先选择'+self.modelPropsList[i].mdTitle+'的模块值信息！'
								})
								self.isClickBtn = false
								return false
							}
						}
						self.isClickBtn = true
						para.tagList = _tagList
						para.stResId = self.ruleForm.stResId
						let _picList = []
						console.log(self.evaluationValuelist)
						self.evaluationValuelist.forEach(item => {
							_picList.push(item)
						})
						self.techPiclist.forEach(item => {
							_picList.push(item)
						})
						self.proofOfMaturitylist.forEach(item => {
							_picList.push(item)
						})
						self.levelEvaluationlist.forEach(item => {
							_picList.push(item)
						})
						para.picList = _picList
						delete para.stResName
						//console.log(para,self.levelEvaluationfileList,'result')
						//return false
						if(self.isAdd) {
							delete para.id
							//添加信息
							postjsonserver(para, "/techGain/add").then(res => {
								if(res.code == '200') {
									self.$message({
										type: 'success',
										message: res.message
									})
									self.isDialog = false
									self.$refs[formName].resetFields()
									self.getPageList()
								} else {
									self.$message({
										type: 'error',
										message: res.message
									})
								}
								self.isClickBtn = false
							})
						} else {
							//修改信息
							postjsonserver(para, "/techGain/update").then(res => {
								if(res.code == '200') {
									self.$message({
										type: 'success',
										message: res.message
									})
									self.isDialog = false
									self.$refs[formName].resetFields()
									self.getPageList()
								} else {
									self.$message({
										type: 'error',
										message: res.message
									})
								}
								self.isClickBtn = false
							})
						}
					} else {
						console.log('error submit!!')
						return false
					}
				})
			},
			resetForm(formName) {
				this.$refs[formName].resetFields()
				//this.restData()
			},
			cancleForm(formName) {
				this.$refs[formName].resetFields()
				this.isDialog = false
				this.isDetails = false
			},
			removeLine() {
				if(this.selectData.length) {
					this.$confirm('删除该数据, 是否继续?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						const para = {
							ids: this.removeIds.toString()
						}
						postserver(para, "/techGain/delete").then(res => {
							if(res.code == '200') {
								this.$message({
									type: 'success',
									message: res.message
								})
								this.getPageList()
							} else {
								this.$message({
									type: 'success',
									message: res.message
								})
							}
						})
					}).catch(() => {
						this.$message({
							type: 'info',
							message: '已取消删除'
						})
					})
				} else {
					this.$message('请先选择需要删除的信息！')
				}
			},
			restData() {
				const self = this
				self.ruleForm.id = ''
				self.ruleForm.stResTime = ''
				self.ruleForm.stResId = ''
				self.ruleForm.ptNo = ''
				self.ruleForm.ptTitle = ''
				self.ruleForm.stDetail = ''
				self.ruleForm.stKeys = ''
				self.ruleForm.ctEmail = ''
				self.ruleForm.ctTel = ''
				self.ruleForm.ctPeople = ''
				self.ruleForm.stArea = ''
				self.ruleForm.stActor = ''
				self.ruleForm.stBelong = ''
				self.ruleForm.stTitle = ''
				self.ruleForm.stResName = ''
				self.evaluationValuefileList = []
				self.levelEvaluationfileList = []
				self.techPicfileList = []
				self.proofOfMaturityfileList =[]
				self.evaluationValuelist = []
				self.techPiclist = []
				self.proofOfMaturitylist = []
				self.levelEvaluationlist = []
				for(let i=0;i<self.modelList.length;i++){
					self.modelPropsList[i].mvId = ''
					self.modelPropsList[i].mdId = ''
					self.modelPropsList[i].mdType = ''
					self.modelPropsList[i].mdTitle = self.modelList[i].mdTitle
					self.modelList[i].mdVId =''
				}
			},
			addLine() {
				const self = this
				self.title = '发布科技成果信息'
				self.restData()
				self.isDialog = true
				self.changeVisible = true
				self.isAdd = true
				
			},
			changeLine() {
				const self = this
				if(self.selectData.length && self.selectData.length === 1) {
					self.isAdd = false
					self.title = '修改科技成果信息'
					self.restData()
					self.loading = true
					getserver({id:self.selectData[0].id}, "/techGain/info").then(res => {
						if(res.code == '200') {
							self.ruleForm.id = res.data.id
							res.data.tagList.forEach(item => {
								for(let i=0;i<self.modelList.length;i++){
									self.modelList[i].mvList.forEach(item1 => {
										if(item1.mvId == item.mvId){
											self.modelPropsList[i].mvId = item.mvId
											self.modelPropsList[i].mdId = item.mdId
											self.modelPropsList[i].mdType = item.mdType
											self.modelPropsList[i].mdTitle = item.mdTitle
											self.modelPropsList[i].mvTitle = item.mvTitle
											self.modelList[i].mdVId = item.mvId
										}
									})
								}
							})
							
							res.data.picList.forEach(item => {
								if(item.name =='evaluationValue'){
									self.evaluationValuelist.push({'name':'evaluationValue','pUrl':item.pUrl})
									self.evaluationValuefileList.push({name:'',url:getImgUrl(item.pUrl),response:{result:item.pUrl}})
								}else if(item.name =='levelEvaluation'){
									self.levelEvaluationlist.push({'name':'levelEvaluation','pUrl':item.pUrl})
									self.levelEvaluationfileList.push({name:'',url:getImgUrl(item.pUrl),response:{result:item.pUrl}})
								}else if(item.name =='techPic'){
									self.techPiclist.push({'name':'techPic','pUrl':item.pUrl})
									self.techPicfileList.push({name:'',url:getImgUrl(item.pUrl),response:{result:item.pUrl}})
								}else{
									self.proofOfMaturitylist.push({'name':'proofOfMaturity','pUrl':item.pUrl})
									self.proofOfMaturityfileList.push({name:'',url:getImgUrl(item.pUrl),response:{result:item.pUrl}})
								}
							})
							
							self.ruleForm.stResTime = res.data.stResTime
							self.ruleForm.stResId = res.data.stResId
							self.ruleForm.ptNo = res.data.ptNo
							self.ruleForm.ptTitle = res.data.ptTitle
							self.ruleForm.stDetail = res.data.stDetail
							self.ruleForm.stKeys = res.data.stKeys
							self.ruleForm.ctEmail = res.data.ctEmail
							self.ruleForm.ctTel = res.data.ctTel
							self.ruleForm.ctPeople = res.data.ctPeople
							self.ruleForm.stArea = res.data.stArea
							self.ruleForm.stActor = res.data.stActor
							self.ruleForm.stBelong = res.data.stBelong
							self.ruleForm.stTitle = res.data.stTitle
							self.ruleForm.stResName = res.data.sdPhone
						}else{
							this.$message({
								type: 'error',
								message: res.message
							})
						}
						self.loading = false
					})
					self.isDialog = true
					self.changeVisible = false
					self.isWine = false
					self.selectId = self.selectData[0].id
				} else {
					this.$message({
						type: 'warning',
						message: '请选择一条信息进行修改！'
					})
				}
			},
			getRow(selection) {
				const self = this
				self.removeIds = []
				self.selectData = selection
				selection.forEach(item => {
					self.removeIds.push(item.id)
				})
			},
			findLine() {
				const para = {
					row: 10,
					page: 1,
					keyword: this.findData
				}
				this.loading = true
				//关键字搜索行
				postserver(para, "/techGain/getPageList").then(res => {
					if(res.code == '200') {
						this.loading = false
						this.dataTotal = res.data.total
						this.tableData = res.data.records
					} else {
						this.$message({
							type: 'error',
							message: res.message
						})
					}
				})
			},
			resetLine() {
				this.findData = ''
			},
			viewLine(obj) {
				const self = this
				self.restData()
				self.loading = true
				getserver({id:obj.id}, "/techGain/info").then(res => {
						if(res.code == '200') {
							self.ruleForm.id = res.data.id
							//modelList  mdVId
							res.data.tagList.forEach(item => {
								for(let i=0;i<self.modelList.length;i++){
									this.modelPropsList[i].mvId = item.mvId
									this.modelPropsList[i].mdId = item.mdId
									this.modelPropsList[i].mdType = item.mdType
									this.modelPropsList[i].mdTitle = item.mdTitle
									self.modelList[i].mvList.forEach(item1 => {
										if(item1.mvId == item.mvId){
											self.modelList[i].mdVId = item.mvId
										}
									})
								}
							})
							res.data.picList.forEach(item => {
								if(item.name =='evaluationValue'){
									self.evaluationValuefileList.push({name:'',url:getImgUrl(item.pUrl)})
								}else if(item.name =='levelEvaluation'){
									self.levelEvaluationfileList.push({name:'',url:getImgUrl(item.pUrl)})
								}else if(item.name =='techPic'){
									self.techPicfileList.push({name:'',url:getImgUrl(item.pUrl)})
								}else{
									self.proofOfMaturityfileList.push({name:'',url:getImgUrl(item.pUrl)})
								}
							})
							self.ruleForm.stResTime = res.data.stResTime
							self.ruleForm.stResId = res.data.stResId
							self.ruleForm.ptNo = res.data.ptNo
							self.ruleForm.ptTitle = res.data.ptTitle
							self.ruleForm.stDetail = res.data.stDetail
							self.ruleForm.stKeys = res.data.stKeys
							self.ruleForm.ctEmail = res.data.ctEmail
							self.ruleForm.ctTel = res.data.ctTel
							self.ruleForm.ctPeople = res.data.ctPeople
							self.ruleForm.stArea = res.data.stArea
							self.ruleForm.stActor = res.data.stActor
							self.ruleForm.stBelong = res.data.stBelong
							self.ruleForm.stTitle = res.data.stTitle
							self.ruleForm.stResName = res.data.sdPhone
						} else {
							this.$message({
								type: 'error',
								message: res.message
							})
						}
						self.loading = false
					})
				self.isDetails = true
				self.selectId = obj.id
			},
			handleRemove(file, fileList) {
		    },
		    handlePreview(file) {
		    },
		    handleAvatarSuccess(response,file,levelEvaluationfileList){
		    },
		    //评估价值的图片上传和删除
		    handleAvatarSuccessevaluationValue(response,file,levelEvaluationfileList){
		    	this.evaluationValuelist.push({'name':'evaluationValue','pUrl': process.env.GET_IMG_API + response.result})
		    },
		    handleRemoveevaluationValue(file, fileList) {
		        for(let i=0;i<this.evaluationValuelist.length;i++){
		        	if(this.evaluationValuelist[i].pUrl == file.response.result){
		        		this.evaluationValuelist.splice(i,1)
		        	}
		        }
		    },
		    //科技图片
		    handleAvatarSuccesstechPic(response,file,levelEvaluationfileList){
		    	this.techPiclist.push({'name':'techPic','pUrl':process.env.GET_IMG_API + response.result})
		    },
		    handleRemovetechPic(file, fileList) {
		    	console.log(file, fileList,'5555')
		        for(let i=0;i<this.techPiclist.length;i++){
		        	if(this.techPiclist[i].pUrl == file.response.result){
		        		this.techPiclist.splice(i,1)
		        	}
		        }
		    },
		    //成熟度证明
		    handleAvatarSuccessproofOfMaturity(response,file,levelEvaluationfileList){
		    	this.proofOfMaturitylist.push({'name':'proofOfMaturity','pUrl':process.env.GET_IMG_API + response.result})
		    },
		    handleRemoveproofOfMaturity(file, fileList) {
		        for(let i=0;i<this.proofOfMaturitylist.length;i++){
		        	if(this.proofOfMaturitylist[i].pUrl == file.response.result){
		        		this.proofOfMaturitylist.splice(i,1)
		        	}
		        }
		    },
		    //水平评价
		    handleAvatarSuccesslevelEvaluation(response,file,levelEvaluationfileList){
		    	//this.evaluationValuelist
		    	this.levelEvaluationlist.push({'name':'levelEvaluation','pUrl':process.env.GET_IMG_API+ response.result})
		    },
		    handleRemovelevelEvaluation(file, fileList) {
		        for(let i=0;i<this.levelEvaluationlist.length;i++){
		        	if(this.levelEvaluationlist[i].pUrl == file.response.result){
		        		this.levelEvaluationlist.splice(i,1)
		        	}
		        }
		    },
			checkLine(obj){
				if(obj.adStatus == 1){
					this.$message('当前数据已审核通过！')
				}else{
					this.$confirm('审核该数据, 是否继续?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						const para = {
							id: obj.id
						}
						postserver(para, "/techGain/check").then(res => {
							if(res.code == '200') {
								this.$message({
									type: 'success',
									message: res.message
								})
								this.getPageList()
							} else {
								this.$message({
									type: 'success',
									message: res.message
								})
							}
						})
					}).catch(() => {
						this.$message({
							type: 'warning',
							message: '已取消审核'
						})
					})
				}
			}
		}
	}
</script>

<style scoped>
	.paging {
		padding: 15px;
		padding-right: 0;
	}
	
	.form-submit {
		margin: 0;
		padding-right: 30px;
	}
	
	.el-dialog__header {
		text-align: center;
	}
	.tree-box{
		height: 180px;
	    overflow: auto;
	    z-index: 999;
	    width: 100%;
	}
	.el-tree{
		min-height: 120px;
	}
	.tree-box{
		padding: 20px;
	    border: 1px solid #dedede;
	    position: absolute;
	    z-index: 999;
	    width: 100%;
	    background: #f1f1f1;
	    margin-top: 10px;
    }
    .tree-box div.triangle{
    	width: 0;
	    height: 0;
	    border-width: 10px;
	    border-style: solid;
	    border-color: transparent transparent #f1f1f1 transparent;
	    font-size: 0;
	    line-height: 0;
	    position: absolute;
	    top: -20px;
    }
    .isactive{
    	background: #1580ef;
    	color: #fff;
    }
</style>